package com.example.star.mapper;

import com.example.star.entity.Address;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface AddressMapper {
    @Insert("INSERT INTO address (username,address) VALUES (#{userName},#{address})")
    void insertAddress(Address address);

    @Select("SELECT * FROM address")
    List<Address> getAddresses();

    @Select("SELECT * FROM address WHERE username = #{userName}")
    List<Address> getAddressByUserName(String userName);
}
